<?php

$start = microtime(TRUE);
$memStart = memory_get_usage();

$justKissPath = getenv('JUSTKISS_PATH');

if (!$justKissPath || version_compare(phpversion(), '5.4', '<'))
{
    throw new Exception('Cannot run JustKiss, check prerequisite for create JustKiss framework');
}

chdir(dirname(__DIR__));

require $justKissPath . '/JustKiss/Autoload/AutoloadSimple.php';


$autoload = new \JustKiss\Autoload\AutoloadSimple();

$autoload->register([
    'namespaces' => [
        'JustKiss' => $justKissPath,
    ],
]);

// Load file class application
require $justKissPath . '/JustKiss/Mvc/Application.php';

(new \JustKiss\Mvc\Application('config/app.config.php'))->run();

$end = microtime(TRUE) - $start;
printf('Completed in %.12f seconds', $end);
$memEnd = (memory_get_usage() - $memStart) / 1024;
printf('<br />Memory used: %.6f KB', $memEnd);
printf('<br />Include number files: %d', count(get_included_files()));